﻿using System;
using System.Threading.Tasks;

namespace Library.Core.Application.IInfrastructure.EntityFrameworkDataAccess
{
    public interface ITransaction : IDisposable
    {
        /// <summary>
        /// 使用CAP扩展EF方法的Transaction
        /// </summary>
        /// <returns></returns>
        ITransaction BeginTransaction();

        ITransaction BeginTransactionEF();

        ITransaction BeginTransactionEF(System.Data.IsolationLevel isolationLevel);

        Task<ITransaction> BeginTransactionEFAsync();

        Task<ITransaction> BeginTransactionEFAsync(System.Data.IsolationLevel isolationLevel);
        void Commit();
        Task CommitAsync();
    }
}
